<!-- syslog表单弹窗 -->
<form id="syslog-form" lay-filter="syslog-form" class="layui-form model-form">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input name="username" placeholder="请输入用户名" type="text" class="layui-input" maxlength="20"  id="username"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">用户操作</label>
        <div class="layui-input-block">
            <input name="operation" placeholder="请输入用户操作" type="text" class="layui-input" maxlength="20"  id="operation"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">请求方法</label>
        <div class="layui-input-block">
            <input name="method" placeholder="请输入请求方法" type="text" class="layui-input" maxlength="20"  id="method"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">请求参数</label>
        <div class="layui-input-block">
            <input name="params" placeholder="请输入请求参数" type="text" class="layui-input" maxlength="20"  id="params"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">执行时长(毫秒)</label>
        <div class="layui-input-block">
            <input name="time" placeholder="请输入执行时长(毫秒)" type="text" class="layui-input" maxlength="20"  id="time"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">IP地址</label>
        <div class="layui-input-block">
            <input name="ip" placeholder="请输入IP地址" type="text" class="layui-input" maxlength="20"  id="ip"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
            <input name="createDate" placeholder="请输入创建时间" type="text" class="layui-input" maxlength="20"  id="createDate"
                   lay-verify="required" required/>
        </div>
    </div>
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;
 
        var syslog = admin.getTempData('t_syslog');
        if (syslog.method=="update"){
        	form.val('syslog-form', syslog);
            form.render();
        }
        
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
 
            admin.req('sys/syslog/'+syslog.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
